#ifndef NIXONBOT_CORE_BNCS_PROTOCOL_STARTADVEXSERVER_H_
#define NIXONBOT_CORE_BNCS_PROTOCOL_STARTADVEXSERVER_H_

#include <nixonbot/core/bncs/protocol/Message.h>
#include <nixonbot/core/bncs/protocol/MessageFactory.h>

namespace nixonbot {
namespace core {
namespace bncs {
namespace protocol {

struct StartAdvExServerData : public QSharedData
{
  quint32 status;
};

class StartAdvExServer : public Message
{
 public:
	static const int id = 0x1c;
	BNCS_MESSAGE_SERVER_REGISTER(StartAdvExServer, id);

 public:
	enum Status
	{
	  STATUS_SUCCESS = 0x00000000,
	  STATUS_FAILED = 0x00000001
	};

public:
	QSharedDataPointer<StartAdvExServerData> d;

public:
	StartAdvExServer()
	{
		d = new StartAdvExServerData();
	}
	
	virtual StartAdvExServer* create()
	{
		return new StartAdvExServer();
	}
	
	virtual quint32 id()
	{
		return id;
	}

	virtual int size()
	{
	  return sizeof(d->status);
	}

protected:
	virtual void readFrom(QDataStream& ds)
	{
		int bo = ds.byteOrder();
		ds.setByteOrder(QDataStream::LittleEndian);
	      
		ds >> status;
		
		ds.setByteOrder((QDataStream::ByteOrder)bo);
	}

	virtual void writeTo(QDataStream& ds)
	{
		int bo = ds.byteOrder();
		ds.setByteOrder(QDataStream::LittleEndian);

		ds << status;

		ds.setByteOrder((QDataStream::ByteOrder)bo);
	}
};

}
}
}
}

#endif
